// 对象赋值 ES6允许把声明的变量直接赋值给对象
let name="jspang";
let skill= 'web';
var obj= {name,skill};
console.log(obj);  //Object {name: "jspang", skill: "web"}

// 对象Key值构建
let key='skill';
var obj={
    [key]:'web'
}
console.log(obj.skill);

// 自定义对象方法
var obj={
    add:function(a,b){
        return a+b;
    }
}
console.log(obj.add(1,2));  //3

// 对象Key值构建
// let key='skill';
// var obj={
//     [key]:'web'
// }
// console.log(obj.skill);


// Object.is(  ) 对象比较
var obj1 = {name:'jspang'};
var obj2 = {name:'jspang'};
console.log(obj1.name === obj2.name);//true
console.log(Object.is(obj1.name,obj2.name)); //true

console.log(+0 === -0);  //true
console.log(NaN === NaN ); //false
console.log(Object.is(+0,-0)); //false
console.log(Object.is(NaN,NaN)); //true

// Object.assign(  )合并对象 
var a={a:'jspang'};
var b={b:'技术胖'};
var c={c:'web'};
 
let d=Object.assign(a,b,c)
console.log(d);